﻿using System;
using System.Collections.Generic;
using System.Text;
using VIX.Enums;

namespace VIX
{
    /// <summary>
    /// Represents an exception thrown by a VIX-API function.
    /// </summary>
    public class VixException : Exception
    {
        #region Constructor/Destructor
        /// <summary>
        /// Initializes a new instance of the VixException class.
        /// </summary>
        /// <param name="message">A message describing the problem.</param>
        /// <param name="code">The error-code returned by the VIX-API function.</param>
        public VixException(string message, VIX_E code)
            : base(message)
        {
            this.ErrorCode = code;
        }

        /// <summary>
        /// Initializes a new instance of the VixException class.
        /// </summary>
        /// <param name="message">A message describing the problem.</param>
        /// <param name="innerException">The <see cref="Exception"/> instance that caused the current exception.</param>
        /// <param name="code">The error-code returned by the VIX-API function.</param>
        public VixException(string message, Exception innerException, VIX_E code)
            : base(message, innerException)
        {
            this.ErrorCode = code;
        }
        #endregion

        #region Properties

        /// <summary>
        /// Gets the error-code returned by the VIX-API function which threw the exception.
        /// </summary>
        public VIX_E ErrorCode
        {
            get;
            private set;
        }
        #endregion
    }
}
